import request from '@/utils/request'

// 查询来料进货入库开单列表
export function listPutStorageAdd(query) {
  return request({
    url: '/putStorage/putStorageAdd/list',
    method: 'get',
    params: query,
  })
}

//查询需要添加的数据
export function listPutStorageAdds(query) {
  return request({
    url: '/putStorage/putStorageAdd/getNeedData',
    method: 'get',
    params: query,
  })
}
// 查询来料进货入库开单详细
export function getPutStorageAdd(rwmId) {
  return request({
    url: '/putStorage/putStorageAdd/' + rwmId,
    method: 'get',
    headers: { pendingKey: '/putStorage/putStorageAdd/' },
  })
}

// 新增来料进货入库开单
export function addPutStorageAdd(data) {
  return request({
    url: '/putStorage/putStorageAdd',
    method: 'post',
    data: data,
  })
}

// 修改来料进货入库开单
export function updatePutStorageAdd(data) {
  return request({
    url: '/putStorage/putStorageAdd',
    method: 'put',
    data: data,
  })
}
// 修改来料进货入库开单
export function checkRwdDet(data) {
  return request({
    url: '/putStorage/putStorageAdd/checkRwdDet',
    method: 'put',
    data: data,
  })
}
// 修改来料进货入库开单
export function postRwdDet(data) {
  return request({
    url: '/putStorage/putStorageAdd/postRwdDet',
    method: 'put',
    data: data,
  })
}

// 删除来料进货入库开单
export function delPutStorageAdd(rwmId) {
  return request({
    url: '/putStorage/putStorageAdd/' + rwmId,
    method: 'delete',
  })
}

// 导出来料进货入库开单
export function exportPutStorageAdd(query) {
  return request({
    url: '/putStorage/putStorageAdd/export',
    method: 'get',
    params: query,
  })
}

//获取有效厂商名称
export function getCs() {
  return request({
    url: '/purchase/csm/getAllCsmByCustomize',
    method: 'get',
  })
}

//获取所有厂商名称
export function getAllCs() {
  return request({
    url: '/purchase/csm/getAllCsmTwo',
    method: 'get',
  })
}

//允收、特采、拒收的操作
export function checkPomPod(rwdDjbh, type) {
  return request({
    url: '/putStorage/putStorageAdd/checkPomPod/' + rwdDjbh + '/' + type,
    method: 'put',
  })
}

// 添加生产或者采购入库明细
export function addRkmx(data) {
  return request({
    url: '/putStorage/putStorageAdd/addNeedData',
    method: 'post',
    data: data,
  })
}

//借料归还
export function addRkmxTwo(data) {
  return request({
    url: '/putStorage/putStorageAdd/addNeedDataTwo',
    method: 'post',
    data: data,
  })
}

//暂收入库
export function addRkmxFive(data) {
  return request({
    url: '/putStorage/putStorageAdd/addNeedDataFive',
    method: 'post',
    data: data,
  })
}

//添加 备品入库  委外加工  回料入库  其他入库 入库明细

export function addRkmxThree(data) {
  return request({
    url: '/putStorage/putStorageAdd/addNeedDataThree',
    method: 'post',
    data: data,
  })
}

// /hd-api/putStorage/putStorageAdd/deleteDetail/{rwmDjbh}/{rwdCgdh}/{rwdWldm}
export function delRwdDeted(rwdId) {
  return request({
    url: '/putStorage/putStorageAdd/deleteDetail/' + rwdId,
    method: 'delete',
  })
}
// /hd-api/putStorage/putStorageAdd/submitDetail/{rwmDjbh}
//提交
export function submitPomPod(rwmDjbh) {
  return request({
    url: '/putStorage/putStorageAdd/submitDetail/' + rwmDjbh,
    method: 'put',
  })
}

// 一键入库
export function allPutStorage(rwmDjbh) {
  return request({
    url: '/putStorage/putStorageAdd/allPutStorage/' + rwmDjbh,
    method: 'put',
  })
}
//过账
export function rwmPost(data) {
  return request({
    url: '/putStorage/putStorageAdd/rwmPost',
    method: 'put',
    data: data,
  })
}

// 打印
export function exportRwm(rwmDjbh) {
  return request({
    url: `/putStorage/putStorageAdd/exportRwm/${rwmDjbh}`,
    method: 'post',
  })
}

// 申请打印
export function applyDy(rwmDjbh) {
  return request({
    url: `/putStorage/putStorageAdd/applyDy/${rwmDjbh}`,
    method: 'post',
  })
}

// 申请打印列表
export function getRwmByApplyDy() {
  return request({
    url: `/putStorage/putStorageAdd/getRwmByApplyDy`,
    method: 'get',
  })
}

// 打印审核
export function checkDy(rwmDjbh) {
  return request({
    url: `/putStorage/putStorageAdd/checkDy/${rwmDjbh}`,
    method: 'post',
  })
}
